#ifndef __TGA_H
#define __TGA_H

/*
	Copyright (C) 1999
	For non-commercial use only.

  	File	: tga.h
	Date	: 05/05/1999
	Author	: Nate Miller
	Contact	: vandals1@home.com
*/

#include <fstream>
using namespace std;

// Error Codes
// file was not found
#define TGA_FILE_NOT_FOUND			13
// color mapped image or image is not RGB uncompressed
#define TGA_BAD_IMAGE_TYPE			14
// dimension is not a power of 2
#define TGA_BAD_DIMENSION			15
// image bits is not 24 or 32
#define TGA_BAD_BITS				16
// image data could not be loaded
#define TGA_BAD_DATA				17

#define TGA_GOOD					1

class RTGA
{
public:
	RTGA();
	~RTGA();
    int loadTGA (const char *name);

	int imageWidth, imageHeight;    
	int size;
    GLenum texFormat;
	unsigned char *imageData;
//    FILE *s;
private:
	int imageBits;

    int checkSize (int x);
    unsigned char *getRGBA (FILE *s, int size);
    unsigned char *getRGB (FILE *s, int size);
    char *getData (FILE *s, int sz, int iBits);
};

#endif